package org.example.demo4;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * @author Gong.Yang
 * Executors常用的线程池创建
 */
public class Demo4 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(6);//固定线程池

        Executors.newCachedThreadPool();          //无限线程线程池，如果有空闲线程则使用空闲线程，无则无限拆功能键。int的最大值

        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(6);//延时

        Executors.newSingleThreadExecutor();    //单线程线程池
    }
}
